/**
 * @param {number[]} nums
 * @return {boolean}
 */
var canJump = function (nums) {
  // 贪心
  let maxJump = nums.length - 1
  // 不用看最后一个数nums.length - 2
  for (let i = nums.length - 2; i >= 0; i--) {
    if (i + nums[i] >= maxJump) maxJump = i //大于就肯定能跳到,往前走
  }
  return maxJump === 0
};